package com.zlz.controller;

import com.zlz.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @Author:曾令忠
 * @Desc:
 * @Date 2020/8/9 0009 17:14
 */
@RestController
public class GoodsController {
    @Autowired
    private GoodsService goodsService;
    @GetMapping("/parse/{key}")
    public boolean parse(@PathVariable("key") String key) throws Exception {
        return goodsService.parseContent(key);
    }

    @GetMapping("/search/{key}/{pageNo}/{pageSize}")
    public List<Map<String,Object>> search(@PathVariable("key") String key,
                                           @PathVariable("pageNo") int pageNo,
                                           @PathVariable("pageSize") int pageSize) throws Exception {
        return goodsService.highlightsearch (key,pageNo,pageSize);
    }
}
